/**
 * @author yuyangyang
 * @time 2015/3/11
 */
var MeetModel = require('../models/meet');

module.exports = {
    addMeet: function (params, callback) {
        new MeetModel(params).save(callback);
    },
    queryBySport: function (params, callback) {
        MeetModel.find(params)
            .where('startTime')
            .gt(new Date())
            .populate('creater')
            .exec(callback);
    },
    queryAll: function (callback) {
        MeetModel.find()
            .where('startTime')
            .gt(new Date())
            .exec(callback);
    },
    queryById: function (params, callback) {
        MeetModel.findById(params)
            .populate('creater')
            .populate('sport')
            .exec(callback);
    }
}